gdk: Add private GLContext::is_current() check
authorBenjamin Otte <otte@redhat.com>
Thu, 2 Feb 2023 01:49:56 +0000 (02:49 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 2 Feb 2023 03:23:51 +0000 (04:23 +0100)
commitc6cef6db526930b4cd925c0998da5acc4d4ab35d
treecd6094b7b2f57a3a9069f4fd765ffc4c47ea0bb1
parentfdea27c04d0a10e8b79bb4fd484788f6853a6f6a
gdk: Add private GLContext::is_current() check

... and use this check in gdk_gl_context_make_current() and
gdk_gl_context_get_current() to make sure the context really is still
current.

The context no longer being current can happen when external GL
implementations make their own contexts current in the same threads GDK
contexts are used in.
And that can happen for example by WebKit.

Theoretically, this should also allow external EGL code to run in X11
applications when GDK chooses to use GLX, but I didn't try it.

Fixes #5392
gdk/gdkglcontext.c
gdk/gdkglcontextprivate.h
gdk/macos/gdkmacosglcontext.c
gdk/win32/gdkglcontext-win32-wgl.c
gdk/x11/gdkglcontext-glx.c